package model;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

public class TReview {
	private int reviewid;
	private int forumid;
	private int ordernum;
	private String reviewcontent;
	private String ipaddr;
	private String createtime;
	private String userid;
	
	public TReview(){
		
	}
	public TReview(ResultSet rs){
		try {
			this.reviewid = rs.getInt("reviewid");
			this.forumid = rs.getInt("forumid");
			
			
			this.ordernum = rs.getInt("ordernum");
			this.reviewcontent = rs.getString("reviewcontent");
					
			this.ipaddr = rs.getString("ipaddr");
			this.createtime = rs.getString("createtime");
			this.userid = rs.getString(userid);
			
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}
	public static List<TReview> toList(ResultSet rs){
		List<TReview> list = new ArrayList<TReview>();
		if(rs!=null)
		{
			try {
				while (rs.next()) {
					TReview user = new TReview();
					user.reviewid = rs.getInt("reviewid");
					user.forumid = rs.getInt("forumid");
					
					
					user.ordernum = rs.getInt("ordernum");
					user.reviewcontent = rs.getString("reviewcontent");
						
					user.ipaddr = rs.getString("ipaddr");
					user.userid = rs.getString("userid");
					list.add(user);
				}
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		return list;
		
	}
	
	public TReview(int reviewid, int forumid, int ordernum,
			String reviewcontent, String ipaddr, String createtime,
			String userid) {
		super();
		this.reviewid = reviewid;
		this.forumid = forumid;
		this.ordernum = ordernum;
		this.reviewcontent = reviewcontent;
		this.ipaddr = ipaddr;
		this.createtime = createtime;
		this.userid = userid;
	}

	public int getReviewid() {
		return reviewid;
	}

	public void setReviewid(int reviewid) {
		this.reviewid = reviewid;
	}

	public int getForumid() {
		return forumid;
	}

	public void setForumid(int forumid) {
		this.forumid = forumid;
	}

	public int getOrdernum() {
		return ordernum;
	}

	public void setOrdernum(int ordernum) {
		this.ordernum = ordernum;
	}

	public String getReviewcontent() {
		return reviewcontent;
	}

	public void setReviewcontent(String reviewcontent) {
		this.reviewcontent = reviewcontent;
	}

	public String getIpaddr() {
		return ipaddr;
	}

	public void setIpaddr(String ipaddr) {
		this.ipaddr = ipaddr;
	}

	public String getCreatetime() {
		return createtime;
	}

	public void setCreatetime(String createtime) {
		this.createtime = createtime;
	}

	public String getUserid() {
		return userid;
	}

	public void setUserid(String userid) {
		this.userid = userid;
	}
	
	
	
	
}
